<?php

class custtypeAction extends Action
{
    public function  save()
    {
        $custtype = new custtypeModel();
        $data=$custtype->create();
        if (!$data)
        {
            $this->error($custtype->getError());
        } else
        {
            $data['adduser']=0;
            $custtype->add($data);
           // $this->assign("jumpUrl", U("custtype/index"));
            $this->success("添加成功");
        }
    }

    public function index()
    {
        $custtype = new custtypeModel();
        import("ORG.Util.Page");
        $totalnum = $custtype->count();
        $list = $custtype->page($_GET['p'])->limit(10)->select();
        $this->assign("list", $list);
        $page = new Page($totalnum, 10);
        $page->rollPage = 10;

        $page->setConfig("prev", "上一页");
        $page->setConfig("next", "下一页");
        $page->setConfig("first", "首页");
        $page->setConfig("last", "末页");
        $page->setConfig("theme", "共%totalRow%%header%条数据 %nowPage%/%totalPage%页  %first% %upPage%   %linkPage%  %downPage% %end%");
        $pageshow = $page->show();
        $this->assign("pageshow", $pageshow);
        $this->display();
    }

    public function  del()
    {
        $custtype = M("custtype");
        if (!$custtype->delete($_GET['id']))
        {
            $this->error("删除失败");
        } else
        {
            $this->success("删除成功");
        }
    }

    public function _empty()
    {
        //空操作
        $this->error("您访问的页面不存在！");
    }

}

?>